#ifndef LOGINWIDGET_H
#define LOGINWIDGET_H

#include <QMap>
#include <QWidget>
#include "global.h"
namespace Ui {
class LoginWidget;
}

class LoginWidget : public QWidget
{
    Q_OBJECT

public:
    explicit LoginWidget(QWidget *parent = nullptr);
    ~LoginWidget();
    void Clear();

private:
    Ui::LoginWidget *ui;
    QMap<TipErr, QString> _tipErrs;
    int _uid;
    QString _token;
    bool count[2];
    void showTip(QString str,QString state); // 显示消息
    void LoginIsEmpty();
    void connectTips();
    void AddTipErr(TipErr te, QString tips);
    void DelTipErr(TipErr te);
    void SlotLoginModFinish(ReqId reqId,QString res,ErrorCodes err);
    void SlotTcpConFinish(bool flag);
    void SlotLoginFailed(int n);
    void initHttpHandlers();
    void setEnableBtn(bool f);
    QMap<ReqId,std::function<void(const QJsonObject&)>> _handlers;
signals:
    void SwitchReg();
    void SwitchRes();
    void SigConnectTcp(ServerInfo si);
};

#endif // LOGINWIDGET_H
